#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
int st[N];
int arr[N];
int n;
int main()
{
	scanf("%d", &n);
	int ans = 0;
	int ma = -100;
	int x = 0;
	for (int i = 0; i < n * 2; i++) {
		scanf("%d", &x);
		st[x]++;
		int flag = 1;
		if (st[x] == 2) {
			ans--;
			flag = 0;
		}
		if (flag) {
			ans++;
			if (ans > ma) {
				ma = ans;
			}
		}
	}
	cout << max(0, ma) << endl;
	return 0;
}